﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WodLib
{
    [Serializable()]
    public abstract class Being : DimensionalObject, IAttackable, IEffectable, ICloneable, ITraitable
    {
        #region Advantages
        [System.ComponentModel.Category(Config.DescriptionConsts.OtherTraits)]
        public virtual int InitiativeModifier
        {
            get;
            set;
        }

        [System.ComponentModel.Category(Config.DescriptionConsts.OtherTraits)]
        public virtual int Defense
        {
            get;
            set;
        }

        [System.ComponentModel.Category(Config.DescriptionConsts.OtherTraits)]
        public virtual int Speed
        {
            get;
            set;
        }

        [System.ComponentModel.Category(Config.DescriptionConsts.OtherTraits)]
        public StateOfBeing Health
        {
            get;
            set;
        }

        #endregion

        public Being()
        {
            Health = new StateOfBeing();
            EffectsList = new List<Effect>();
        }

        #region IEffectable Members
        [System.ComponentModel.Editor(typeof(WodLib.Controls.WodCollectionEditor<Effect>),
            typeof(System.Drawing.Design.UITypeEditor))]
        public List<Effect> EffectsList
        {
            get;
            set;
        }

        #endregion

        #region ICloneable Members

        public virtual object Clone()
        {
            Being tmp = (Being)this.MemberwiseClone();
            tmp.Health = (StateOfBeing)this.Health.Clone();
            tmp.EffectsList = new List<Effect>(this.EffectsList.Capacity);
            foreach (var item in this.EffectsList)
            {
                tmp.EffectsList.Add((Effect)item.Clone());
            }
            return tmp;
        }

        #endregion



        #region ITraitable Members

        public virtual Dictionary<string, int> GetIntegerTraits()
        {
            return WodLib.Tools.TraitDictionaryLister<int>.FindAllTraits(this);
        }

        #endregion
    }
}
